package com.yiwangqingshui.many.demo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author smc
 * @date 2019-02-22 10:00
 * @since
 **/
public class ProxyDemo implements InvocationHandler {


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.printf("动态代理里面的线程： %s \n", Thread.currentThread().getName());


        return  exec(method,args);
    }



    public Object exec(Method method,Object[] args){

        if (method.getName().equalsIgnoreCase("say")){
            String param =  (String)args[0];
            return "you say "+ param;
        }






        return null;


    }


















}
